home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / editor / auror300.zip / LONGLINE.AML < prev    next >
Text File  |  1996-07-17  |  1KB  |  47 lines

  1. //--------------------------------------------------------------------
  2. // LONGLINE.AML
  3. // Find the Longest Line, (C) 1993-1996 by nuText Systems
  4. //
  5. // This macro moves the cursor to the end of the longest line in the
  6. // current edit window.
  7. //
  8. // Usage:
  9. //
  10. // Select this macro from the Macro List (on the Macro menu), or run it
  11. // from the macro picklist <shift f12>.
  12. //--------------------------------------------------------------------
  13.  
  14. // compile time macros and function definitions
  15. include bootpath "define.aml"
  16.  
  17. variable maxlength
  18.  
  19. // test for edit windows
  20. if not wintype? "edit" then
  21.   msgbox "Edit windows only!"
  22.   return
  23. end
  24.  
  25. // make cursor position undo-able and goto file top
  26. undocursor
  27. row 1
  28.  
  29. // do for all lines in the file
  30. repeat
  31.  
  32.   // if the line length > current longest line..
  33.   if getlinelen > maxlength then
  34.  
  35.     // ..then make it the longest line and save the row
  36.     maxlength = getlinelen
  37.     longestline = getrow
  38.   end
  39. until not down
  40.  
  41. // goto to the end of the longest line
  42. row longestline
  43. col getlinelen + 1
  44.  
  45. // use 'onfound' (in Ext.aml) to adjust the window view if needed
  46. send "onfound"
  47.